package com.ycg.vue.modules.system.controller;

import com.ycg.vue.modules.system.Dto.BillTypeDTO;
import com.ycg.vue.modules.system.service.BillService;
import com.ycg.vue.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @Description
 * @Author jink
 * @Date 2024/6/13
 */
@Slf4j
@RestController
@RequestMapping("/bill/")
public class BillController {

    @Resource
    private BillService billService;

    @PostMapping("billTypeList")
    public Result billTypeList(@RequestBody BillTypeDTO billTypeDTO) {
        return billService.billTypeList(billTypeDTO);
    }

    @RequestMapping("uploadImg")
    public Result uploadImg(@RequestParam("file") MultipartFile file) {
        return billService.uploadImg(file);
    }

    @PostMapping("InsertNewType")
    public Result InsertNewType(@RequestBody BillTypeDTO billTypeDTO) {
        return billService.InsertNewType(billTypeDTO);
    }

    @PostMapping("updateType")
    public Result updateType(@RequestBody BillTypeDTO billTypeDTO) {
        return billService.updateType(billTypeDTO);
    }

    @DeleteMapping("deleteType/{id}")
    public Result deleteType(@PathVariable String id) {
        return billService.deleteType(id);
    }

}
